/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package reportcenter.report.dominio.param;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import reportcenter.report.dominio.InterfaceFluente;
import reportcenter.report.dominio.report.Report;

/**
 *
 * @author renan
 */
@Entity
@Table(name = "REPORT_PARAM")
@NamedQueries({@NamedQuery(name = "ReportParam.findByIdRp", query = "SELECT r FROM ReportParam r WHERE r.idRp = :idRp"), @NamedQuery(name = "ReportParam.findByParamName", query = "SELECT r FROM ReportParam r WHERE r.paramName = :paramName"), @NamedQuery(name = "ReportParam.findByParamClazz", query = "SELECT r FROM ReportParam r WHERE r.paramClazz = :paramClazz"), @NamedQuery(name = "ReportParam.findByParamAnswer", query = "SELECT r FROM ReportParam r WHERE r.paramAnswer = :paramAnswer")})
public class ReportParam implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "ID_RP", nullable = false)
    private Integer idRp;
    @Column(name = "PARAM_NAME", nullable = false)
    private String paramName;
    @Column(name = "PARAM_CLAZZ", nullable = false)
    private String paramClazz;
    @Column(name = "PARAM_ANSWER", nullable = false)
    private String paramAnswer;
    @JoinColumn(name = "ID_R", referencedColumnName = "ID_R")
    @ManyToOne
    private Report idR;
    
    
    public ReportParam() {
    }
    
    public static InterfaceFluenteReportParam criarCom() {
        return InterfaceFluente.create(
                new ReportParam(), InterfaceFluenteReportParam.class);
    }

    public ReportParam(Integer idRp) {
        this.idRp = idRp;
    }

    public ReportParam(Integer idRp, String paramName, String paramClazz, String paramAnswer) {
        this.idRp = idRp;
        this.paramName = paramName;
        this.paramClazz = paramClazz;
        this.paramAnswer = paramAnswer;
    }

    public Integer getIdRp() {
        return idRp;
    }

    public void setIdRp(Integer idRp) {
        this.idRp = idRp;
    }

    public String getParamName() {
        return paramName;
    }

    public void setParamName(String paramName) {
        this.paramName = paramName;
    }

    public String getParamClazz() {
        return paramClazz;
    }

    public void setParamClazz(String paramClazz) {
        this.paramClazz = paramClazz;
    }

    public String getParamAnswer() {
        return paramAnswer;
    }

    public void setParamAnswer(String paramAnswer) {
        this.paramAnswer = paramAnswer;
    }

    public Report getIdR() {
        return idR;
    }

    public void setIdR(Report idR) {
        this.idR = idR;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRp != null ? idRp.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReportParam)) {
            return false;
        }
        ReportParam other = (ReportParam) object;
        if ((this.idRp == null && other.idRp != null) || (this.idRp != null && !this.idRp.equals(other.idRp))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "reportcenter.report.dominio.param.ReportParam[idRp=" + idRp + "]";
    }

}
